Type.registerNamespace("Telerik.Web.UI");
Type.registerNamespace("Telerik.Web.UI.WindowManager");
function GetRadWindowManager(){return Telerik.Web.UI.WindowManager.Manager;
}window.radalert=function(e,c,a,b){var d=GetRadWindowManager();
return d.radalert(e,c,a,b);
};
window.radconfirm=function(g,d,c,a,f,b){var e=GetRadWindowManager();
return e.radconfirm(g,d,c,a,f,b);
};
window.radprompt=function(f,c,e,d,b,a,g){var h=GetRadWindowManager();
return h.radprompt(f,c,e,d,b,a,g);
};
window.radopen=function(b,a){var c=GetRadWindowManager();
return c.open(b,a);
};
window.radopenWithContainer=function(c,a){var d=GetRadWindowManager();
var b=$get(c);
if(!b){radalert("Content element with such ClientID not found!<br/> Make sure you have provided a correct ClientID!");
return;
}return d.open(null,a,b);
};
Telerik.Web.UI.RadWindowManager=function(a){Telerik.Web.UI.RadWindowManager.initializeBase(this,[a]);
this._windowIDs=[];
this._windows=[];
this._preserveClientState=false;
this.Open=this.open;
this.GetWindowByName=this.getWindowByName;
this.GetWindowById=this.getWindowById;
this.GetActiveWindow=this.getActiveWindow;
this.GetWindowObjects=this.get_windows;
this.GetWindows=this.get_windows;
this.Cascade=this.cascade;
this.Tile=this.tile;
this.RestoreAll=this.restoreAll;
this.MaximizeAll=this.maximizeAll;
this.MinimizeAll=this.minimizeAll;
this.ShowAll=this.showAll;
this.CloseAll=this.closeAll;
this.CloseActiveWindow=this.closeActiveWindow;
this.MinimizeActiveWindow=this.minimizeActiveWindow;
this.RestoreActiveWindow=this.restoreActiveWindow;
};
Telerik.Web.UI.RadWindowManager.prototype={get_zIndex:function(){return Telerik.Web.UI.RadWindowUtils._zIndex;
},set_zIndex:function(a){var b=parseInt(a);
if(isNaN(a)){return;
}Telerik.Web.UI.RadWindowUtils._zIndex=a;
},initialize:function(b){try{var a=this.get_element().style.zIndex;
if(a){this.set_zIndex(a);
}}catch(c){}this._initialize();
this._registerAsPageManager();
if(this.get_preserveClientState()){this.restoreState();
}},dispose:function(){var a=this.get_preserveClientState();
if(a){this.saveState();
}this._disposeWindows();
this._windows=null;
Telerik.Web.UI.RadWindowManager.callBaseMethod(this,"dispose");
},open:function(d,a,b){var c=this.getWindowByName(a);
if(!c){if(!a){a=this.get_id()+this._getUniqueId();
}c=this._createWindow(a,b);
var e=this.get_element().className;
if(e){c.set_cssClass(e.replace(/^ /,""));
}}else{if(b&&this.get_navigateUrl()){c._dockMode=false;
}}if(d&&!c.get_reloadOnShow()&&c._iframe&&c._iframe.src!=d){c.setUrl(d);
}else{if(d){c._navigateUrl=d;
}}c.show();
return c;
},radalert:function(e,c,a,b){var d=this._getStandardPopup("alert",e);
if(typeof(b)!="undefined"){d.set_title(b);
}d.setSize(c?c:280,a?a:200);
d.center();
d.show();
return d;
},radconfirm:function(g,d,c,a,f,b){var e=this._getStandardPopup("confirm",g);
if(typeof(b)!="undefined"){e.set_title(b);
}e.setSize(c?c:280,a?a:200);
e.set_clientCallBackFunction(function(h,j){if(d){d(j);
}});
e.center();
e.show();
return e;
},radprompt:function(h,e,g,f,c,b,j){var d=this._getStandardPopup("prompt",h,j);
if(typeof(b)!="undefined"){d.set_title(b);
}d.setSize(g?g:280,f?f:200);
d.set_clientCallBackFunction(function(k,l){if(e){e(l);
}});
d.center();
d.show();
if(j&&$telerik.isIE){var a=d.get_popupElement().getElementsByTagName("INPUT")[0];
if(a){a.value=j;
}}return d;
},getActiveWindow:function(){return Telerik.Web.UI.RadWindowController.get_activeWindow();
},getWindowById:function(d){var b=this.get_windows();
for(var c=0;
c<b.length;
c++){var a=b[c];
if(d==a.get_id()){return a;
}}return null;
},getWindowByName:function(a){var c=this.get_windows();
if(!c){return null;
}for(var d=0;
d<c.length;
d++){var b=c[d];
if(a==b.get_name()){return b;
}}return null;
},removeWindow:function(b){if(!b){return;
}var c=this.getWindowByName(b.get_name());
var a=this.get_windows();
if(c){Array.remove(a,c);
}},_getUniqueId:function(){return""+(new Date()-100);
},_initialize:function(){var c=this._windowIDs;
for(var b=0;
b<c.length;
b++){var d=c[b];
var a=$find(d);
if(!a){continue;
}a.set_windowManager(this);
this._windows[this._windows.length]=a;
}},_disposeWindows:function(){for(var b=0;
b<this._windows.length;
b++){var a=this._windows[b];
if(a.isCloned()){a.dispose();
}}this._windows=[];
},clearCloneCache:function(){this.__clonedProperties__=null;
},_createWindow:function(a,b){var c=this.clone(a);
c.set_modal(c.isModal());
c.set_name(a);
this._windows[this._windows.length]=c;
c.set_windowManager(this);
if(b){c.set_contentElement(b);
c._dockMode=true;
c.set_behaviors(c.get_behaviors()&~Telerik.Web.UI.WindowBehaviors.Reload);
}return c;
},_replaceLocalization:function(c,d){var b=/##LOC\[(.*?)\]##/;
while(c.match(b)){var a=d[RegExp.$1]?d[RegExp.$1]:"";
c=c.replace(b,a);
}return c;
},_getStandardPopup:function(d,b,h){var g=this._createWindow(d+this._getUniqueId(),false);
g.set_destroyOnClose(true);
g.set_restrictionZoneID(null);
g.set_modal(true);
var j=document.getElementById(this.get_id()+"_"+d.toLowerCase()+"template");
var e=$telerik.isIE?"''":"";
var a=this._stringFormat(j.innerHTML,g.get_id(),b,h?h:e);
a=this._replaceLocalization(a,Telerik.Web.UI.RadWindowUtils.Localization);
var c=document.createElement("DIV");
c.innerHTML=a;
g.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
g.set_visibleStatusbar(false);
g._isPredefined=true;
g.set_contentElement(c);
var f=g.get_contentElement().getElementsByTagName("INPUT")[0];
if(!f){f=g.get_contentElement().getElementsByTagName("A")[0];
}if(f&&f.focus){window.setTimeout(function(){var l=true;
if(f.setActive){try{f.setActive();
l=false;
}catch(k){}}if(l){f.focus();
}},0);
}return g;
},_stringFormat:function(b){for(var a=1;
a<arguments.length;
a++){b=b.replace(new RegExp("\\{"+(a-1)+"\\}","ig"),arguments[a]);
}return b;
},_registerAsPageManager:function(){var a=Telerik.Web.UI.WindowManager.Manager;
var b=this.get_id();
if(a&&a.get_id()==b){a.dispose();
Telerik.Web.UI.WindowManager.Manager=null;
}if(a&&!a.get_id()){Telerik.Web.UI.WindowManager.Manager=null;
}if(!Telerik.Web.UI.WindowManager.Manager){Telerik.Web.UI.WindowManager.Manager=this;
}},saveWindowState:function(c){if(!c||!c.isCreated()){return;
}var a=c.getWindowBounds();
var b=(c.isVisible()||c.isMinimized())+"@"+a.width+"@"+a.height+"@"+a.x+"@"+a.y+"@"+c.isMinimized();
this._setRadWindowCookie(c.get_id(),b);
},saveState:function(){var a=this.get_windows();
for(i=0;
i<a.length;
i++){var b=a[i];
if(b.isCloned()){this.saveWindowState(b);
}}},restoreState:function(){function d(e,f){var g=f.split("@");
if(g.length>1){if("true"==g[0]&&!e.isVisible()){e.show();
}window.setTimeout(function(){if(parseInt(g[1])>0){e.set_width(g[1]);
}if(parseInt(g[2])>0){e.set_height(g[2]);
}if("true"==g[0]){e.moveTo(parseInt(g[3]),parseInt(g[4]));
}if("true"==g[5]){e.minimize();
}},1);
}}var a=this.get_windows();
for(i=0;
i<a.length;
i++){var b=a[i];
var c=this._getRadWindowCookie(b.get_id());
if(c){d(b,c);
}}},_getOnlyCookie:function(){var c="RadWindowCookie";
var a=document.cookie.split("; ");
for(var d=0;
d<a.length;
d++){var b=a[d].split("=");
if(c==b[0]){return b[1];
}}return null;
},_setRadWindowCookie:function(e,c){e="["+e+"]";
var d=this._getOnlyCookie();
var b="";
var a="";
if(d){var g=d.split(e);
if(g&&g.length>1){b=g[0];
a=g[1].substr(g[1].indexOf("#")+1);
}else{a=d;
}}var f=new Date();
f.setFullYear(f.getFullYear()+10);
document.cookie="RadWindowCookie="+(b+e+"-"+c+"#"+a)+";path=/;expires="+f.toUTCString()+";";
},_getRadWindowCookie:function(c){var a=this._getOnlyCookie();
if(!a){return;
}var b=null;
c="["+c+"]";
var e=a.indexOf(c);
if(e>=0){var d=e+c.length+1;
b=a.substring(d,a.indexOf("#",d));
}return b;
},cascade:function(){var e=0;
var c=0;
var a=this._getWindowsSortedByZindex();
for(var d=0;
d<a.length;
d++){var b=a[d];
if(!b.isClosed()&&b.isVisible()){var f=b.restore();
b.moveTo(e,c);
b.setActive(true);
e+=25;
c+=25;
}}},tile:function(){var m=this._getWindowsSortedByZindex();
var h=0;
for(var a=0;
a<m.length;
a++){var e=m[a];
if(!e.isClosed()&&e.isVisible()){h++;
}}var f=5;
var g=0;
var n=1;
if(h<=f){g=h;
}else{var a=2;
while((h*a)<(f*(a+1))){a++;
if(a>6){break;
}}n=a;
g=Math.ceil(h/n);
}var b=$telerik.getClientBounds();
var j=Math.floor(b.width/g);
var l=Math.floor(b.height/n);
var d=document.documentElement.scrollLeft||document.body.scrollLeft;
var c=document.documentElement.scrollTop||document.body.scrollTop;
var k=0;
for(var a=0;
a<m.length;
a++){var e=m[a];
if(!e.isClosed()&&e.isVisible()){k++;
if((k-1)%(g)==0&&k>g){c+=l;
d=document.documentElement.scrollLeft||document.body.scrollLeft;
}e.restore();
e.moveTo(d,c);
e.setSize(j,l);
d+=j;
}}},closeActiveWindow:function(){this._executeActiveWindow("close");
},minimizeActiveWindow:function(){this._executeActiveWindow("minimize");
},restoreActiveWindow:function(){this._executeActiveWindow("restore");
},closeAll:function(){this._executeAll("close");
},showAll:function(){this._executeAll("show");
},minimizeAll:function(){this._executeAll("minimize");
},maximizeAll:function(){this._executeAll("maximize");
},restoreAll:function(){this._executeAll("restore");
},_getWindowsSortedByZindex:function(){var a=this._windows.concat([]);
var b=function(d,e){var f=d.get_zindex();
var c=e.get_zindex();
if(f==c){return 0;
}return(f<c?-1:1);
};
return a.sort(b);
},_executeAll:function(b){if(!this._windows){return;
}var a=this._windows.concat([]);
for(var c=0;
c<a.length;
c++){a[c][b]();
}},_executeActiveWindow:function(a){var b=this.getActiveWindow();
if(b&&"function"==typeof(b[a])){b[a]();
}},get_preserveClientState:function(){return this._preserveClientState;
},set_preserveClientState:function(a){if(this._preserveClientState!=a){this._preserveClientState=a;
}},set_windowControls:function(a){this._windowIDs=eval(a);
this._disposeWindows();
},set_child:function(a){},get_windowControls:function(){},get_windows:function(){return this._windows;
}};
Telerik.Web.UI.RadWindowManager.registerClass("Telerik.Web.UI.RadWindowManager",Telerik.Web.UI.RadWindow);
